package webday03;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 演示请求转发（forward）
 * 
 *  请求一个servlet -> 后台处理 -> 跳转到一个结果页面
 *  
 *  forward，只能把请求转发到服务器内部的servlet或者html（jsp）
 * 
 * @author luohui
 *
 * http://localhost/day03/forward
 * http://localhost/day03/form.html
 * 
 * / : 代表服务器的根路径
 */

public class Forward extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//		System.out.println(req);
		
		System.out.println(req.getParameter("name"));
		
		req.getRequestDispatcher("index.html").forward(req,resp);
	}
}
